Changeset 825


Ignore:
Timestamp:
Nov 12, 2013, 5:54:34 PM (12 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: small code cleanup

Location:
trunk/server/lib/tdb/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/lib/tdb/common/lock.c

    r783 r825  
    123123        APIRET      rc;
    124124        ULONG       fAccess = 0; // default exclusiv
    125         int         fLock = 1;   // default lock
    126         off_t       cbFile;
    127         off_t       offStart;
    128         off_t       cbRange;
    129125        FILELOCK    lockArea = {0}, unlockArea = {0}, unlockArea1 = {0};
    130126
     
    143139        {
    144140                case F_UNLCK:
    145                         fLock = 0;
    146141                        unlockArea.lOffset = off;
    147142                        unlockArea.lRange  = len ? len : tdb->header.hash_size *4; //was LONG_MAX
  • trunk/server/lib/tdb/common/open.c

    r782 r825  
    243243
    244244#ifdef __OS2__
    245         if (os2_crtsem(tdb, name, "tdb_open_ex") != 0) {
     245        if (os2_CrtSem(tdb, "tdb_open_ex") != 0) {
    246246                goto fail;
    247247        }
     
    512512                        TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to close tdb->fd on error!\n"));
    513513#ifdef __OS2__
    514         DosCloseMutexSem( tdb->hGlobalLock);
    515         tdb->hGlobalLock = 0;
    516         DosCloseMutexSem( tdb->hActiveLock);
    517         tdb->hActiveLock = 0;
    518         DosCloseMutexSem( tdb->hTransactionLock);
    519         tdb->hTransactionLock = 0;
     514        os2_DltSem(tdb, "tdb_open_ex");
    520515#endif
    521516        SAFE_FREE(tdb->lockrecs);
     
    570565
    571566#ifdef __OS2__
    572         DosCloseMutexSem( tdb->hGlobalLock);
    573         tdb->hGlobalLock = 0;
    574         DosCloseMutexSem( tdb->hActiveLock);
    575         tdb->hActiveLock = 0;
    576         DosCloseMutexSem( tdb->hTransactionLock);
    577         tdb->hTransactionLock = 0;
     567        os2_DltSem(tdb, "tdb_close");   
    578568#endif
    579569        /* Remove from contexts list */
     
    618608
    619609#ifdef __OS2__
    620         DosCloseMutexSem( tdb->hGlobalLock);
    621         tdb->hGlobalLock = 0;
    622         DosCloseMutexSem( tdb->hActiveLock);
    623         tdb->hActiveLock = 0;
    624         DosCloseMutexSem( tdb->hTransactionLock);
    625         tdb->hTransactionLock = 0;
    626 
    627         if (os2_crtsem(tdb, tdb->name, "tdb_reopen") != 0) {
     610        os2_DltSem(tdb, "tdb_reopen");
     611
     612        if (os2_CrtSem(tdb, "tdb_reopen") != 0) {
    628613                goto fail;
    629614        }
     
    720705
    721706#ifdef __OS2__
    722 int os2_crtsem(struct tdb_context *tdb, const char *name, const char *caller)
    723 {
    724         // name could be null, so handle it
    725         if (name == NULL) return -1;
     707int os2_CrtSem(struct tdb_context *tdb, const char *caller)
     708{
     709        // tbd->name could be null, so handle it
     710        if (tdb->name == NULL) return -1;
    726711       
    727712        if (!(tdb->flags & TDB_INTERNAL))
     
    732717                APIRET  rc;
    733718                // extract path info
    734                 _splitpath( name, drive, dir, fname, ext);
     719                _splitpath( tdb->name, drive, dir, fname, ext);
    735720                sprintf( szSem, "\\SEM32\\TDB_OL_%s%s%s%i", dir, fname, ext, global_Sem32Add);
    736721                rc = DosCreateMutexSem( szSem, &tdb->hGlobalLock, 0, FALSE);
     
    768753        return 0;
    769754}
    770 #endif
     755
     756int os2_DltSem(struct tdb_context *tdb, const char *caller)
     757{
     758        DosCloseMutexSem( tdb->hGlobalLock);
     759        tdb->hGlobalLock = 0;
     760        DosCloseMutexSem( tdb->hActiveLock);
     761        tdb->hActiveLock = 0;
     762        DosCloseMutexSem( tdb->hTransactionLock);
     763        tdb->hTransactionLock = 0;
     764
     765        return 0;
     766}
     767#endif
Note: See TracChangeset for help on using the changeset viewer.