Remove remaining unnecessary 'volatile' qualifiers

This commit is contained in:
Pawel Dziepak
2013-11-06 00:03:07 +01:00
parent d929eb20ba
commit 73ad2473e7
45 changed files with 69 additions and 68 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ extern void __length_error (const char *);
#endif
#ifdef __HAIKU__
extern "C" __haiku_int32 atomic_add(volatile __haiku_int32* value,
extern "C" __haiku_int32 atomic_add(__haiku_int32* value,
__haiku_int32 addvalue);
#endif /* __HAIKU__ */
@@ -82,7 +82,7 @@ private:
charT* data () { return reinterpret_cast<charT *>(this + 1); }
charT& operator[] (size_t s) { return data () [s]; }
#ifdef __HAIKU__
charT* grab () { if (selfish) return clone (); atomic_add((volatile __haiku_int32*) &ref, 1); return data (); }
charT* grab () { if (selfish) return clone (); atomic_add((__haiku_int32*) &ref, 1); return data (); }
void release() { if (atomic_add((__haiku_int32*) &ref, -1) == 1) delete this; }
#else
charT* grab () { if (selfish) return clone (); ++ref; return data (); }
+1 -1
View File
@@ -113,7 +113,7 @@ private:
private:
bool fStarted;
area_id fArea;
volatile BPrivate::media::TimeSourceTransmit* fBuf;
BPrivate::media::TimeSourceTransmit* fBuf;
BPrivate::media::SlaveNodes* fSlaveNodes;
area_id _reserved_area;
+1 -1
View File
@@ -54,7 +54,7 @@ private:
virtual status_t _Reserved_Renderer_3(int32, void *);
virtual status_t _Reserved_Renderer_4(int32, void *);
volatile int32 fRefCount; // How much we're still usefull?
int32 fRefCount; // How much we're still usefull?
BGLView* fView; // Never forget who is the boss!
ulong fOptions; // Keep that tune in memory
BGLDispatcher* fDispatcher; // Our personal OpenGL API call dispatcher
@@ -14,7 +14,7 @@
typedef struct lock {
sem_id sem;
vint32 count;
int32 count;
} lock;
+2 -2
View File
@@ -14,7 +14,7 @@
typedef struct lock {
sem_id sem;
vint32 count;
int32 count;
} lock;
@@ -82,4 +82,4 @@ class Autolock {
};
#endif /* LOCK_H */
#endif /* LOCK_H */
@@ -17,7 +17,7 @@ enum {
};
struct messaging_area_header {
vint32 lock_counter;
int32 lock_counter;
int32 size; // set to 0, when area is discarded
area_id kernel_area;
area_id next_kernel_area;
+1 -1
View File
@@ -47,7 +47,7 @@ typedef struct rw_lock {
struct rw_lock_waiter* waiters;
spinlock lock;
thread_id holder;
vint32 count;
int32 count;
int32 owner_count;
int16 active_readers;
// Only > 0 while a writer is waiting: number
+1 -1
View File
@@ -406,7 +406,7 @@ private:
TeamTimeUserTimerList fCPUTimeUserTimers;
// protected by scheduler lock
TeamUserTimeUserTimerList fUserTimeUserTimers;
vint32 fUserDefinedTimerCount; // accessed atomically
int32 fUserDefinedTimerCount; // accessed atomically
};
+1 -1
View File
@@ -68,7 +68,7 @@ struct team_debug_info {
thread_id causing_thread;
// thread that caused the debugger to be attached; -1 for manual
// debugger attachment (or no debugger installed)
vint32 image_event;
int32 image_event;
// counter incremented whenever an image is created/deleted
struct ConditionVariable* debugger_changed_condition;
+1 -1
View File
@@ -136,7 +136,7 @@ public:
#endif
#if DEBUG_PAGE_ACCESS
vint32 accessing_thread;
int32 accessing_thread;
#endif
#if VM_PAGE_ALLOCATION_TRACKING_AVAILABLE
+2 -2
View File
@@ -17,12 +17,12 @@ struct select_sync;
typedef struct select_info {
struct select_info* next; // next in the object's list
struct select_sync* sync;
vint32 events;
int32 events;
uint16 selected_events;
} select_info;
typedef struct select_sync {
vint32 ref_count;
int32 ref_count;
sem_id sem;
uint32 count;
struct select_info* set;
+1 -1
View File
@@ -54,7 +54,7 @@ private:
private:
sem_id fSemaphore;
vint32 fAtom;
int32 fAtom;
_shared_buffer_info fInfos[kMaxBuffers];
int32 fCount;
+1 -1
View File
@@ -53,7 +53,7 @@ status_t TestForAddonExistence(const char* name, directory_which which,
// Reference counted object
class Object {
private:
volatile int32 fRefCount;
int32 fRefCount;
public:
// After construction reference count is 1
@@ -151,7 +151,7 @@ struct acpi_ec_cookie {
mutex ec_lock;
int ec_burstactive;
int ec_sci_pending;
vint32 ec_gencount;
int32 ec_gencount;
ConditionVariable ec_condition_var;
int ec_suspending;
};
@@ -25,7 +25,7 @@ hda_open(const char* name, uint32 flags, void** cookie)
if (controller == NULL)
return ENODEV;
if (controller->opened != 0)
if (atomic_get(&controller->opened) != 0)
return B_BUSY;
status_t status = hda_hw_init(controller);
@@ -65,7 +65,7 @@ struct hda_multi;
*/
struct hda_controller {
struct pci_info pci_info;
vint32 opened;
int32 opened;
const char* devfs_path;
area_id regs_area;
@@ -97,7 +97,7 @@ virtual status_t ReadMACAddress(ether_address_t *address);
bool fRemoved;
bool fHasConnection;
bool fNonBlocking;
vint32 fInsideNotify;
int32 fInsideNotify;
// interface and device infos
uint16 fFrameSize;
@@ -162,7 +162,7 @@ static void _NotifyCallback(void *cookie, int32 status,
bool fHasConnection;
bool fTXBufferFull;
bool fNonBlocking;
vint32 fInsideNotify;
int32 fInsideNotify;
// pipes for notifications, data io and tx packet size
usb_pipe fNotifyEndpoint;
@@ -45,7 +45,7 @@ static void _NotifyCallback(void *cookie, int32 status,
status_t fStatus;
bool fOpen;
bool fRemoved;
vint32 fInsideNotify;
int32 fInsideNotify;
usb_device fDevice;
uint16 fVendorID;
uint16 fProductID;
+1 -1
View File
@@ -63,7 +63,7 @@ class Semaphore {
private:
sem_id fSemaphore;
#ifdef USE_BENAPHORE
vint32 fCount;
int32 fCount;
#endif
};
@@ -107,7 +107,7 @@ private:
uint32 fRepairCount;
mutex fRepairLock;
vint32 fXID;
int32 fXID;
};
@@ -179,7 +179,7 @@ WebCamMediaAddOn::FillDefaultFlavorInfo(flavor_info* info)
info->info = "USB Web Camera";
info->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE | B_PHYSICAL_INPUT;
info->flavor_flags = 0;//B_FLAVOR_IS_GLOBAL;
info->internal_id = atomic_add((vint32 *)&fInternalIDCounter, 1);
info->internal_id = atomic_add((int32*)&fInternalIDCounter, 1);
info->possible_count = 1;//0;
info->in_format_count = 0;
info->in_format_flags = 0;
@@ -21,7 +21,7 @@ class Referenceable {
bool Release();
private:
vint32 fReferenceCount;
int32 fReferenceCount;
};
#endif // REFERENCABLE_H
+1 -1
View File
@@ -149,7 +149,7 @@ private:
bool fStarted; // has Start() been called?
sem_id fWaitForThreads; // to exit
int32 fN; // the number of used filter threads
volatile int32 fNumberOfThreads; // the current number of FilterThreads
int32 fNumberOfThreads; // the current number of FilterThreads
volatile bool fIsRunning; // FilterThreads should process data as long as it is true
BBitmap* fSrcImage;
bool fDestImageInitialized;
+1 -1
View File
@@ -86,7 +86,7 @@ private:
CacheList fCacheEntriesByAge;
QueueMap fQueueMap;
QueueDeque fQueue;
vint32 fThreadCount;
int32 fThreadCount;
int32 fMaxThreadCount;
uint64 fBytes;
uint64 fMaxBytes;
+3 -3
View File
@@ -1205,9 +1205,9 @@ TermParse::_ReadParserBuffer()
fBuffer->Unlock();
// wait for new input from pty
if (fReadBufferSize == 0) {
if (atomic_get(&fReadBufferSize) == 0) {
status_t status = B_OK;
while (fReadBufferSize == 0 && status == B_OK) {
while (atomic_get(&fReadBufferSize) == 0 && status == B_OK) {
do {
status = acquire_sem(fReaderSem);
} while (status == B_INTERRUPTED);
@@ -1224,7 +1224,7 @@ TermParse::_ReadParserBuffer()
}
}
int32 toRead = fReadBufferSize;
int32 toRead = atomic_get(&fReadBufferSize);
if (toRead > ESC_PARSER_BUFFER_SIZE)
toRead = ESC_PARSER_BUFFER_SIZE;
+1 -1
View File
@@ -73,7 +73,7 @@ private:
uint fBufferPosition;
uchar fReadBuffer[READ_BUF_SIZE];
vint32 fReadBufferSize;
int32 fReadBufferSize;
uchar fParserBuffer[ESC_PARSER_BUFFER_SIZE];
int32 fParserBufferSize;
@@ -463,7 +463,7 @@ int
ieee80211_node_dectestref(struct ieee80211_node* ni)
{
// atomic_add returns old value
return atomic_add((vint32*)&ni->ni_refcnt, -1) == 1;
return atomic_add((int32*)&ni->ni_refcnt, -1) == 1;
}
+1 -1
View File
@@ -19,7 +19,7 @@
#endif
static vint32 gID = 1;
static int32 gID = 1;
BRawNetBuffer::BRawNetBuffer()
+1 -1
View File
@@ -74,7 +74,7 @@ private:
uint32 fBeginHeader[3];
uint32 fEndHeader[3];
thread_id fRescanThread;
vint32 fRescanRequested;
int32 fRescanRequested;
BLocker fRescanLock;
};
+1 -1
View File
@@ -89,7 +89,7 @@ class PrintServerApp : public BApplication, public FolderListener {
BBitmap *fSelectedIconMini;
BBitmap *fSelectedIconLarge;
#endif
vint32 fReferences;
int32 fReferences;
sem_id fHasReferences;
Settings *fSettings;
bool fUseConfigWindow;
+1 -1
View File
@@ -110,7 +110,7 @@ private:
// the next job to process
Job* fJob;
// the current nmber of processing threads
vint32 fProcessing;
int32 fProcessing;
// stop processing
bool fAbort;
static BObjectList<Printer> sPrinters;
@@ -50,7 +50,7 @@ struct MimeSnifferAddonManager::AddonReference {
private:
BMimeSnifferAddon* fAddon;
vint32 fReferenceCount;
int32 fReferenceCount;
};
@@ -39,7 +39,7 @@ private:
std::list<RegistrarThread*>::iterator& RemoveThread(std::list<RegistrarThread*>::iterator &i);
std::list<RegistrarThread*> fThreads;
vint32 fThreadCount;
int32 fThreadCount;
};
#endif // THREAD_MANAGER_H
@@ -17,8 +17,8 @@
struct X86PagingStructures : DeferredDeletable {
phys_addr_t pgdir_phys;
vint32 ref_count;
vint32 active_on_cpus;
int32 ref_count;
int32 active_on_cpus;
// mask indicating on which CPUs the map is currently used
X86PagingStructures();
+3 -3
View File
@@ -139,10 +139,10 @@ static int32 sCurrentLine = 0;
static debugger_demangle_module_info* sDemangleModule;
static Thread* sDebuggedThread;
static vint32 sInDebugger = 0;
static int32 sInDebugger = 0;
static bool sPreviousDprintfState;
static volatile bool sHandOverKDL = false;
static vint32 sHandOverKDLToCPU = -1;
static int32 sHandOverKDLToCPU = -1;
static bool sCPUTrapped[B_MAX_CPU_COUNT];
@@ -1007,7 +1007,7 @@ hand_over_kernel_debugger()
// hand over to another CPU without us noticing. Since this is only
// initiated by the user, it is harmless, though.
sHandOverKDL = true;
while (sHandOverKDLToCPU >= 0)
while (atomic_get(&sHandOverKDLToCPU) >= 0)
PAUSE();
}
+1 -1
View File
@@ -104,7 +104,7 @@ private:
void _WakeUpLocker();
private:
vint32 fFlags;
int32 fFlags;
static Bucket sBuckets[kBucketCount];
};
+2 -2
View File
@@ -99,7 +99,7 @@ remove_user_mutex_entry(UserMutexEntry* entry)
static status_t
user_mutex_lock_locked(vint32* mutex, addr_t physicalAddress, const char* name,
user_mutex_lock_locked(int32* mutex, addr_t physicalAddress, const char* name,
uint32 flags, bigtime_t timeout, MutexLocker& locker)
{
// mark the mutex locked + waiting
@@ -148,7 +148,7 @@ user_mutex_lock_locked(vint32* mutex, addr_t physicalAddress, const char* name,
static void
user_mutex_unlock_locked(vint32* mutex, addr_t physicalAddress, uint32 flags)
user_mutex_unlock_locked(int32* mutex, addr_t physicalAddress, uint32 flags)
{
if (UserMutexEntry* entry = sUserMutexTable.Lookup(physicalAddress)) {
// Someone is waiting -- set the locked flag. It might still be set,
+1 -1
View File
@@ -141,7 +141,7 @@ public:
private:
char* fName;
vint32 fRefCount;
int32 fRefCount;
uid_t fUID;
gid_t fGID;
mode_t fPermissions;
+2 -2
View File
@@ -631,8 +631,8 @@ static mutex sIpcLock;
static mutex sXsiSemaphoreSetLock;
static uint32 sGlobalSequenceNumber = 1;
static vint32 sXsiSemaphoreCount = 0;
static vint32 sXsiSemaphoreSetCount = 0;
static int32 sXsiSemaphoreCount = 0;
static int32 sXsiSemaphoreSetCount = 0;
// #pragma mark -
+4 -4
View File
@@ -29,7 +29,7 @@ struct per_cpu_timer_data {
spinlock lock;
timer* volatile events;
timer* volatile current_event;
vint32 current_event_in_progress;
int32 current_event_in_progress;
bigtime_t real_time_offset;
};
@@ -264,7 +264,7 @@ timer_interrupt()
cpuData.events = (timer*)event->next;
cpuData.current_event = event;
cpuData.current_event_in_progress = 1;
atomic_set(&cpuData.current_event_in_progress, 1);
release_spinlock(spinlock);
@@ -277,7 +277,7 @@ timer_interrupt()
if (event->hook)
rc = event->hook(event);
cpuData.current_event_in_progress = 0;
atomic_set(&cpuData.current_event_in_progress, 0);
acquire_spinlock(spinlock);
@@ -447,7 +447,7 @@ cancel_timer(timer* event)
if (cpu != smp_get_current_cpu()) {
spinLocker.Unlock();
while (cpuData.current_event_in_progress == 1) {
while (atomic_get(&cpuData.current_event_in_progress) == 1) {
PAUSE();
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ random_value()
unsigned int
secure_random_value()
{
static vint32 count = 0;
static int32 count = 0;
uint32 data[8];
data[0] = atomic_add(&count, 1);
+10 -9
View File
@@ -119,9 +119,9 @@ static page_num_t sNonExistingPages;
static uint64 sIgnoredPages;
// pages of physical memory ignored by the boot loader (and thus not
// available here)
static vint32 sUnreservedFreePages;
static vint32 sUnsatisfiedPageReservations;
static vint32 sModifiedTemporaryPages;
static int32 sUnreservedFreePages;
static int32 sUnsatisfiedPageReservations;
static int32 sModifiedTemporaryPages;
static ConditionVariable sFreePageCondition;
static mutex sPageDeficitLock = MUTEX_INITIALIZER("page deficit");
@@ -1407,7 +1407,7 @@ static uint32
reserve_some_pages(uint32 count, uint32 dontTouch)
{
while (true) {
int32 freePages = sUnreservedFreePages;
int32 freePages = atomic_get(&sUnreservedFreePages);
if (freePages <= (int32)dontTouch)
return 0;
@@ -1456,7 +1456,7 @@ static inline void
unreserve_pages(uint32 count)
{
atomic_add(&sUnreservedFreePages, count);
if (sUnsatisfiedPageReservations != 0)
if (atomic_get(&sUnsatisfiedPageReservations) != 0)
wake_up_page_reservation_waiters();
}
@@ -1744,7 +1744,8 @@ page_scrubber(void *unused)
snooze(100000); // 100ms
if (sFreePageQueue.Count() == 0
|| sUnreservedFreePages < (int32)sFreePagesTarget) {
|| atomic_get(&sUnreservedFreePages)
< (int32)sFreePagesTarget) {
continue;
}
@@ -1880,7 +1881,7 @@ private:
uint32 fMaxPages;
uint32 fWrapperCount;
uint32 fTransferCount;
vint32 fPendingTransfers;
int32 fPendingTransfers;
PageWriteWrapper* fWrappers;
PageWriteTransfer* fTransfers;
ConditionVariable fAllFinishedCondition;
@@ -2206,7 +2207,7 @@ PageWriterRun::AddPage(vm_page* page)
uint32
PageWriterRun::Go()
{
fPendingTransfers = fTransferCount;
atomic_set(&fPendingTransfers, fTransferCount);
fAllFinishedCondition.Init(this, "page writer wait for I/O");
ConditionVariableEntry waitEntry;
@@ -3005,7 +3006,7 @@ reserve_pages(uint32 count, int priority, bool dontWait)
bool notifyDaemon = sUnsatisfiedPageReservations == 0;
sUnsatisfiedPageReservations += count;
if (sUnreservedFreePages > dontTouch) {
if (atomic_get(&sUnreservedFreePages) > dontTouch) {
// the situation changed
sUnsatisfiedPageReservations -= count;
continue;
@@ -19,7 +19,7 @@ extern char _single_threaded;
static inline int
__compare_and_swap (volatile int32 *p, int oldval, int newval)
{
int32 readval = atomic_test_and_set(p, newval, oldval);
int32 readval = atomic_test_and_set((int32*)p, newval, oldval);
return (readval == oldval ? 1 : 0);
}
@@ -55,7 +55,7 @@ pthread_once(pthread_once_t* onceControl, void (*initRoutine)(void))
// initRoutine. All following threads will return right away.
while (true) {
int32 value = atomic_test_and_set((vint32*)&onceControl->state,
int32 value = atomic_test_and_set((int32*)&onceControl->state,
STATE_INITIALIZING, STATE_UNINITIALIZED);
if (value == STATE_INITIALIZED)
@@ -83,7 +83,7 @@ pthread_once(pthread_once_t* onceControl, void (*initRoutine)(void))
sem_id semaphore = create_sem(0, "pthread once");
if (semaphore >= 0) {
// successfully created -- set it
value = atomic_test_and_set((vint32*)&onceControl->state,
value = atomic_test_and_set((int32*)&onceControl->state,
semaphore, STATE_INITIALIZING);
if (value == STATE_INITIALIZING)
value = semaphore;
@@ -93,7 +93,7 @@ pthread_once(pthread_once_t* onceControl, void (*initRoutine)(void))
// Failed to create the semaphore. Can only happen when the
// system runs out of semaphores, but we can still handle the
// situation gracefully by spinning.
value = atomic_test_and_set((vint32*)&onceControl->state,
value = atomic_test_and_set((int32*)&onceControl->state,
STATE_SPINNING, STATE_INITIALIZING);
if (value == STATE_INITIALIZING)
value = STATE_SPINNING;