Wednesday, November 23, 2005, 11:59:24 AM, Robert Shearman wrote:
Vitaliy Margolen wrote:
Wednesday, November 23, 2005, 11:05:05 AM, Robert Shearman wrote: Using object_attr: static struct object *create_mapping( const struct object_attr *attr, file_pos_t size, int protect, obj_handle_t handle )
No using object_attr: static struct object *create_mapping( const struct object *root, const struct unicode_str *name, unsigned int attr, file_pos_t size, int protect, obj_handle_t handle )
That obviously should be a "struct directory *" (note: not const since you will be inserting it into the directory) if it isn't an obj_handle_t. However, I agree that the check would be best inside of create_named_object_dir, since nothing else in the creation paths is going to use the root directory and the root directory will always be of type "directory". I don't really have an opinion on whether a struct object_attr is better than passing parameters explicitly.
Ok, then this is what we have: 1. Pass arguments explicitly to each function (rootdir, name, attributes). 2. Don't use object_attr structure.
Only left is to decide what rootdir should be (struct object*, struct directory * or obj_handle_t). The only place that knows enough and does all the checking is find_object_dir (create_object_dir calls it to do most of the work). It can't be (struct directory*) because I'm planning on using these functions for named pipes, mail slots, win stations and desktops.
So we have only chose of (struct object *) or (obj_handle_t). I'm thinking we should use (struct object *) then. And call get_directory_obj in each [open|create]_*
Now, about inserting a new object into a name space. Will it be ok to add one more function to object_ops? Something like
int obj_insert(struct object *parent, struct object *new_obj); /* 1 on success */