diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-01-31 19:57:14 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-01-31 19:57:14 +0000 |
commit | 641f9fbadb5e2315d51e47f1d0328276e2922868 (patch) | |
tree | edbe0e68287fa92c760732e732b4fdc5359dfabb /libdiskfs | |
parent | 6470bc777f48dd82ada4cd5857e2b0ce982f56e0 (diff) |
Formerly priv.h.~4~
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/priv.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libdiskfs/priv.h b/libdiskfs/priv.h index 1a66131d..7d88fd28 100644 --- a/libdiskfs/priv.h +++ b/libdiskfs/priv.h @@ -34,3 +34,27 @@ diskfs_end_using_protid_port (struct protid *cred) { ports_done_with_port (cred); } + +/* This macro locks the node associated with PROTID, and then + evaluates the expression OPERATION; then it syncs the inode + (without waiting) and unlocks everything, and then returns + the value `err' (which can be set by OPERATION if desired). */ +#define CHANGE_NODE_FIELD(PROTID, OPERATION) \ +({ \ + error_t err = 0; \ + struct node *np; \ + \ + if (!(PROTID)) \ + return EOPNOTSUPP; \ + \ + if (readonly) \ + return EROFS; \ + \ + np = (PROTID)->po->np; \ + \ + mutex_lock (&np->lock); \ + (OPERATION); \ + diskfs_node_update (np, 0); \ + mutex_unlock (&np->lock); \ + return err; \ +}) |