aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEvgeniy Polyakov <zbr@ioremap.net>2009-03-27 08:04:23 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-17 14:06:30 -0400
commite504342448375ffd73dec2b540a5aaf5da6f8439 (patch)
treed60321eb21b56d4e7e9c1d774a0aad51fcafc990 /drivers
parent872dc5e500cc25e3c35d83510dfbd6fb8d78221b (diff)
Staging: Pohmelfs: Extend remount option.
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/pohmelfs/inode.c73
1 files changed, 46 insertions, 27 deletions
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c
index 00570d9c265a..3fef09fd712c 100644
--- a/drivers/staging/pohmelfs/inode.c
+++ b/drivers/staging/pohmelfs/inode.c
@@ -1169,16 +1169,17 @@ err_out_put:
1169static int pohmelfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 1169static int pohmelfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1170{ 1170{
1171 struct inode *inode = dentry->d_inode; 1171 struct inode *inode = dentry->d_inode;
1172#if 0
1172 struct pohmelfs_inode *pi = POHMELFS_I(inode); 1173 struct pohmelfs_inode *pi = POHMELFS_I(inode);
1173 int err; 1174 int err;
1174#if 0 1175
1175 err = pohmelfs_data_lock(pi, 0, ~0, POHMELFS_READ_LOCK); 1176 err = pohmelfs_data_lock(pi, 0, ~0, POHMELFS_READ_LOCK);
1176 if (err) 1177 if (err)
1177 return err; 1178 return err;
1178#endif
1179 dprintk("%s: ino: %llu, mode: %o, uid: %u, gid: %u, size: %llu.\n", 1179 dprintk("%s: ino: %llu, mode: %o, uid: %u, gid: %u, size: %llu.\n",
1180 __func__, pi->ino, inode->i_mode, inode->i_uid, 1180 __func__, pi->ino, inode->i_mode, inode->i_uid,
1181 inode->i_gid, inode->i_size); 1181 inode->i_gid, inode->i_size);
1182#endif
1182 1183
1183 generic_fillattr(inode, stat); 1184 generic_fillattr(inode, stat);
1184 return 0; 1185 return 0;
@@ -1346,12 +1347,6 @@ static void pohmelfs_put_super(struct super_block *sb)
1346 pohmelfs_ftrans_exit(); 1347 pohmelfs_ftrans_exit();
1347} 1348}
1348 1349
1349static int pohmelfs_remount(struct super_block *sb, int *flags, char *data)
1350{
1351 *flags |= MS_RDONLY;
1352 return 0;
1353}
1354
1355static int pohmelfs_statfs(struct dentry *dentry, struct kstatfs *buf) 1350static int pohmelfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1356{ 1351{
1357 struct super_block *sb = dentry->d_sb; 1352 struct super_block *sb = dentry->d_sb;
@@ -1394,42 +1389,33 @@ static int pohmelfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
1394 return 0; 1389 return 0;
1395} 1390}
1396 1391
1397static const struct super_operations pohmelfs_sb_ops = {
1398 .alloc_inode = pohmelfs_alloc_inode,
1399 .destroy_inode = pohmelfs_destroy_inode,
1400 .drop_inode = pohmelfs_drop_inode,
1401 .write_inode = pohmelfs_write_inode,
1402 .put_super = pohmelfs_put_super,
1403 .remount_fs = pohmelfs_remount,
1404 .statfs = pohmelfs_statfs,
1405 .show_options = pohmelfs_show_options,
1406};
1407
1408enum { 1392enum {
1409 pohmelfs_opt_idx, 1393 pohmelfs_opt_idx,
1394 pohmelfs_opt_crypto_thread_num,
1395 pohmelfs_opt_trans_max_pages,
1396 pohmelfs_opt_crypto_fail_unsupported,
1397
1398 /* Remountable options */
1410 pohmelfs_opt_trans_scan_timeout, 1399 pohmelfs_opt_trans_scan_timeout,
1411 pohmelfs_opt_drop_scan_timeout, 1400 pohmelfs_opt_drop_scan_timeout,
1412 pohmelfs_opt_wait_on_page_timeout, 1401 pohmelfs_opt_wait_on_page_timeout,
1413 pohmelfs_opt_trans_retries, 1402 pohmelfs_opt_trans_retries,
1414 pohmelfs_opt_crypto_thread_num,
1415 pohmelfs_opt_trans_max_pages,
1416 pohmelfs_opt_crypto_fail_unsupported,
1417 pohmelfs_opt_mcache_timeout, 1403 pohmelfs_opt_mcache_timeout,
1418}; 1404};
1419 1405
1420static struct match_token pohmelfs_tokens[] = { 1406static struct match_token pohmelfs_tokens[] = {
1421 {pohmelfs_opt_idx, "idx=%u"}, 1407 {pohmelfs_opt_idx, "idx=%u"},
1408 {pohmelfs_opt_crypto_thread_num, "crypto_thread_num=%u"},
1409 {pohmelfs_opt_trans_max_pages, "trans_max_pages=%u"},
1410 {pohmelfs_opt_crypto_fail_unsupported, "crypto_fail_unsupported"},
1422 {pohmelfs_opt_trans_scan_timeout, "trans_scan_timeout=%u"}, 1411 {pohmelfs_opt_trans_scan_timeout, "trans_scan_timeout=%u"},
1423 {pohmelfs_opt_drop_scan_timeout, "drop_scan_timeout=%u"}, 1412 {pohmelfs_opt_drop_scan_timeout, "drop_scan_timeout=%u"},
1424 {pohmelfs_opt_wait_on_page_timeout, "wait_on_page_timeout=%u"}, 1413 {pohmelfs_opt_wait_on_page_timeout, "wait_on_page_timeout=%u"},
1425 {pohmelfs_opt_trans_retries, "trans_retries=%u"}, 1414 {pohmelfs_opt_trans_retries, "trans_retries=%u"},
1426 {pohmelfs_opt_crypto_thread_num, "crypto_thread_num=%u"},
1427 {pohmelfs_opt_trans_max_pages, "trans_max_pages=%u"},
1428 {pohmelfs_opt_crypto_fail_unsupported, "crypto_fail_unsupported"},
1429 {pohmelfs_opt_mcache_timeout, "mcache_timeout=%u"}, 1415 {pohmelfs_opt_mcache_timeout, "mcache_timeout=%u"},
1430}; 1416};
1431 1417
1432static int pohmelfs_parse_options(char *options, struct pohmelfs_sb *psb) 1418static int pohmelfs_parse_options(char *options, struct pohmelfs_sb *psb, int remount)
1433{ 1419{
1434 char *p; 1420 char *p;
1435 substring_t args[MAX_OPT_ARGS]; 1421 substring_t args[MAX_OPT_ARGS];
@@ -1449,6 +1435,9 @@ static int pohmelfs_parse_options(char *options, struct pohmelfs_sb *psb)
1449 if (err) 1435 if (err)
1450 return err; 1436 return err;
1451 1437
1438 if (remount && token <= pohmelfs_opt_crypto_fail_unsupported)
1439 continue;
1440
1452 switch (token) { 1441 switch (token) {
1453 case pohmelfs_opt_idx: 1442 case pohmelfs_opt_idx:
1454 psb->idx = option; 1443 psb->idx = option;
@@ -1485,6 +1474,25 @@ static int pohmelfs_parse_options(char *options, struct pohmelfs_sb *psb)
1485 return 0; 1474 return 0;
1486} 1475}
1487 1476
1477static int pohmelfs_remount(struct super_block *sb, int *flags, char *data)
1478{
1479 int err;
1480 struct pohmelfs_sb *psb = POHMELFS_SB(sb);
1481 unsigned long old_sb_flags = sb->s_flags;
1482
1483 err = pohmelfs_parse_options(data, psb, 1);
1484 if (err)
1485 goto err_out_restore;
1486
1487 if (!(*flags & MS_RDONLY))
1488 sb->s_flags &= ~MS_RDONLY;
1489 return 0;
1490
1491err_out_restore:
1492 sb->s_flags = old_sb_flags;
1493 return err;
1494}
1495
1488static void pohmelfs_flush_inode(struct pohmelfs_inode *pi, unsigned int count) 1496static void pohmelfs_flush_inode(struct pohmelfs_inode *pi, unsigned int count)
1489{ 1497{
1490 struct inode *inode = &pi->vfs_inode; 1498 struct inode *inode = &pi->vfs_inode;
@@ -1753,6 +1761,17 @@ err_out_exit:
1753 return err; 1761 return err;
1754} 1762}
1755 1763
1764static const struct super_operations pohmelfs_sb_ops = {
1765 .alloc_inode = pohmelfs_alloc_inode,
1766 .destroy_inode = pohmelfs_destroy_inode,
1767 .drop_inode = pohmelfs_drop_inode,
1768 .write_inode = pohmelfs_write_inode,
1769 .put_super = pohmelfs_put_super,
1770 .remount_fs = pohmelfs_remount,
1771 .statfs = pohmelfs_statfs,
1772 .show_options = pohmelfs_show_options,
1773};
1774
1756/* 1775/*
1757 * Allocate private superblock and create root dir. 1776 * Allocate private superblock and create root dir.
1758 */ 1777 */
@@ -1816,7 +1835,7 @@ static int pohmelfs_fill_super(struct super_block *sb, void *data, int silent)
1816 mutex_init(&psb->state_lock); 1835 mutex_init(&psb->state_lock);
1817 INIT_LIST_HEAD(&psb->state_list); 1836 INIT_LIST_HEAD(&psb->state_list);
1818 1837
1819 err = pohmelfs_parse_options((char *) data, psb); 1838 err = pohmelfs_parse_options((char *) data, psb, 0);
1820 if (err) 1839 if (err)
1821 goto err_out_free_sb; 1840 goto err_out_free_sb;
1822 1841