apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44127] - File Extended Attributes Support
Date Sat, 05 Jan 2008 14:45:59 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44127>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44127





------- Additional Comments From michael@metaparadigm.com  2008-01-05 06:45 -------
I have been working on an implementation of mod_dav_fs properties using this
extended attribute interface and have found that the apr_file_t* based interface
is not really that usable (especially with regards to directories). It would
need apr_dir_xattr_(get|set|list|remove) interfaces added doubling the number of
functions. I had very ugly code as follows (where const char *pathname would be
much more appropriate) - needs an apr_stat to work out if it is a file or dir.

    apr_finfo_t finfo;
    apr_dir_t *dir = NULL;
    apr_file_t *file = NULL;
    apr_os_dir_t *osdir;
    apr_os_file_t osfile;
    apr_status_t status;

    status = apr_stat(&finfo, fname, APR_FINFO_TYPE, p);
    if(status != APR_SUCCESS) {
        return status;
    }
    if(finfo.filetype == APR_DIR) {
        status = apr_dir_open(&dir, fname, p);
        if(status != APR_SUCCESS) {
            return status;
        }
        apr_os_dir_get(&osdir, dir);
        osfile = dirfd(osdir); /* non-portable */
        apr_os_file_put(&file, &osfile, 0, p);
    } else {
        status = apr_file_open(&file, fname, APR_READ | APR_WRITE, 0, p);
        if(status != APR_SUCCESS) {
            return status;
        }
    }
    status = apr_file_xattr_get(file, attrname, &attrvalue, &attrsize, 0);

where if I had a pathname based interface it would just be:

    status = apr_file_xattr_get(fname, attrname, &attrvalue, &attrsize, 0);

I have since changed the interface back to my original proposal of const char
*pathname (as well as adding more test cases). Patches to follow.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message