rtems-users Digest, Vol 7, Issue 20

shizheng neversetsun at ustc.edu
Sat Apr 21 02:03:39 UTC 2007


rtems-users-request at rtems.org wrote:
> ------------------------------
>
> Message: 2
> Date: Fri, 20 Apr 2007 08:41:59 -0500
> From: Joel Sherrill <joel.sherrill at oarcorp.com>
> Subject: Re: three quesions about filesytem
> To: neversetsun at ustc.edu
> Cc: rtems-users at rtems.org
> Message-ID: <4628C327.9060708 at oarcorp.com>
> Content-Type: text/plain; charset=GB2312
>
> shizheng wrote:
>   
>> Hi:
>>
>>   1.
>>       rtems_libio_is_valid_perms always returns non-zero value,
>>       so I can't catch why it's called in IMFS_evaluate_permission and IMFS_eval_path.
>>
>>       #define RTEMS_LIBIO_PERMS_RWX    S_IRWXO
>>       /*
>>        * Verifies that the permission flag is valid.
>>        */
>>       #define rtems_libio_is_valid_perms( _perm )     \
>>        (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
>>
>>             
>>
>>     
> This is only used to check for an assert condition. Did somehow a bit
> get set in
> the permissions that isn't even defined.
>   
But I dont' think there's a situation that the macro will check the undefined bit set in 
"_perm" parameter, becasue

(~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm )) = (RTEMS_LIBIO_PERMS_RWX || (~_perm))


The macro maybe like this:

      #define rtems_libio_is_valid_perms( _perm )     \
       (~( ((~RTEMS_LIBIO_PERMS_RWX) & _perm ) & (~RTEMS_LIBIO_PERM_RWX)))

Then it will check out the bits set outside RTEMS_LIBIO_PERMS_RWX which is 007.




More information about the users mailing list