Skip to content

Commit

Permalink
AFS: implement statfs
Browse files Browse the repository at this point in the history
Implement the statfs() op for AFS.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed May 11, 2007
1 parent 0f300ca commit 45222b9
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 15 deletions.
23 changes: 23 additions & 0 deletions fs/afs/afs.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#define AFS_MAXCELLNAME 64 /* maximum length of a cell name */
#define AFS_MAXVOLNAME 64 /* maximum length of a volume name */
#define AFSNAMEMAX 256 /* maximum length of a filename plus NUL */
#define AFSPATHMAX 1024 /* maximum length of a pathname plus NUL */
#define AFSOPAQUEMAX 1024 /* maximum length of an opaque field */

typedef unsigned afs_volid_t;
typedef unsigned afs_vnodeid_t;
Expand Down Expand Up @@ -143,4 +146,24 @@ struct afs_volsync {
time_t creation; /* volume creation time */
};

/*
* AFS volume status record
*/
struct afs_volume_status {
u32 vid; /* volume ID */
u32 parent_id; /* parent volume ID */
u8 online; /* true if volume currently online and available */
u8 in_service; /* true if volume currently in service */
u8 blessed; /* same as in_service */
u8 needs_salvage; /* true if consistency checking required */
u32 type; /* volume type (afs_voltype_t) */
u32 min_quota; /* minimum space set aside (blocks) */
u32 max_quota; /* maximum space this volume may occupy (blocks) */
u32 blocks_in_use; /* space this volume currently occupies (blocks) */
u32 part_blocks_avail; /* space available in volume's partition */
u32 part_max_blocks; /* size of volume's partition */
};

#define AFS_BLOCK_SIZE 1024

#endif /* AFS_H */
3 changes: 2 additions & 1 deletion fs/afs/afs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ enum AFS_FS_Operations {
FSMAKEDIR = 141, /* AFS Create a directory */
FSREMOVEDIR = 142, /* AFS Remove a directory */
FSGIVEUPCALLBACKS = 147, /* AFS Discard callback promises */
FSGETVOLUMEINFO = 148, /* AFS Get root volume information */
FSGETVOLUMEINFO = 148, /* AFS Get information about a volume */
FSGETVOLUMESTATUS = 149, /* AFS Get volume status information */
FSGETROOTVOLUME = 151, /* AFS Get root volume name */
FSLOOKUP = 161, /* AFS lookup file in directory */
FSFETCHDATA64 = 65537, /* AFS Fetch file data */
Expand Down
18 changes: 9 additions & 9 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,

ASSERTCMP(dentry->d_inode, ==, NULL);

if (dentry->d_name.len > 255) {
if (dentry->d_name.len >= AFSNAMEMAX) {
_leave(" = -ENAMETOOLONG");
return ERR_PTR(-ENAMETOOLONG);
}
Expand Down Expand Up @@ -736,7 +736,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -801,7 +801,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -847,7 +847,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -921,7 +921,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -990,7 +990,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
dentry->d_name.name);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -1038,11 +1038,11 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
content);

ret = -ENAMETOOLONG;
if (dentry->d_name.len > 255)
if (dentry->d_name.len >= AFSNAMEMAX)
goto error;

ret = -EINVAL;
if (strlen(content) > 1023)
if (strlen(content) >= AFSPATHMAX)
goto error;

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -1112,7 +1112,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dentry->d_name.name);

ret = -ENAMETOOLONG;
if (new_dentry->d_name.len > 255)
if (new_dentry->d_name.len >= AFSNAMEMAX)
goto error;

key = afs_request_key(orig_dvnode->volume->cell);
Expand Down
Loading

0 comments on commit 45222b9

Please sign in to comment.