lkml.org 
[lkml]   [2004]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectUSER_DS vs oldfs

    A common idiom in the compat code is:

    old_fs = get_fs();
    set_fs(KERNEL_DS);
    ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
    ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
    (unsigned long)&f);
    set_fs(old_fs);

    Surely we know that the current 'fs' is USER_DS and so we could simply do:

    set_fs(KERNEL_DS);
    ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
    ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
    (unsigned long)&f);
    set_fs(USER_DS);

    --
    "Next the statesmen will invent cheap lies, putting the blame upon
    the nation that is attacked, and every man will be glad of those
    conscience-soothing falsities, and will diligently study them, and refuse
    to examine any refutations of them; and thus he will by and by convince
    himself that the war is just, and will thank God for the better sleep
    he enjoys after this process of grotesque self-deception." -- Mark Twain
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:06    [W:0.022 / U:0.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site